package com.innodealing.kafka.model;

/**
 * kafka消息
 * @author Yinpenghai
 */
public class KafkaMessage {
    private String topic;
    private int partition;
    private long offset;
    private long timestamp;
    private String messageKey;
    private String content;

    /**
     * 构造方法
     * @param topic 主题
     * @param partition 分区
     * @param offset 消费位置
     * @param timestamp 消费时间戳
     * @param messageKey 消息key
     * @param content 消息内容
     */
    public KafkaMessage(String topic, int partition, long offset, long timestamp, String messageKey, String content) {
        this.topic = topic;
        this.partition = partition;
        this.offset = offset;
        this.timestamp = timestamp;
        this.messageKey = messageKey;
        this.content = content;
    }

    public String getTopic() {
        return topic;
    }

    public void setTopic(String topic) {
        this.topic = topic;
    }

    public int getPartition() {
        return partition;
    }

    public void setPartition(int partition) {
        this.partition = partition;
    }

    public long getOffset() {
        return offset;
    }

    public void setOffset(long offset) {
        this.offset = offset;
    }

    public long getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(long timestamp) {
        this.timestamp = timestamp;
    }

    public String getMessageKey() {
        return messageKey;
    }

    public void setMessageKey(String messageKey) {
        this.messageKey = messageKey;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    @Override
    public String toString() {
        return "KafkaMessage{" +
                "topic='" + topic + '\'' +
                ", partition=" + partition +
                ", offset=" + offset +
                ", timestamp=" + timestamp +
                ", messageKey='" + messageKey + '\'' +
                ", content='" + content + '\'' +
                '}';
    }
}
